package org.wappumobileapp;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

import android.app.TabActivity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.widget.AnalogClock;
import android.widget.TabHost;
import android.widget.TabHost.TabContentFactory;
import android.widget.TabHost.TabSpec;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

import dataobjects.Message;

public class History extends TabActivity {
	
	public static String nick = null;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
		setContentView(R.layout.history);
		getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
				R.layout.windowtitle);
		
		Intent myIntent = getIntent();
		nick = myIntent.getStringExtra("Nick");
		
        TabHost tabHost = getTabHost();
        
        // Tab for Likes
        TabSpec myLikes = tabHost.newTabSpec("myLikes");
        // setting Title and Icon for the Tab
        myLikes.setIndicator("Likes", getResources().getDrawable(R.drawable.ic_tab_my_likes));
        Intent likesIntent = new Intent(this, MyLikes.class);
        likesIntent.putExtra("Nick", nick);
        myLikes.setContent(likesIntent);
        tabHost.addTab(myLikes); // Adding Posts tab
 
        // Tab for Posts
        TabSpec myPosts = tabHost.newTabSpec("myPosts");
        myPosts.setIndicator("Posts", getResources().getDrawable(R.drawable.ic_tab_my_suggestion));
        Intent postsIntent = new Intent(this, MyPosts.class);     
        postsIntent.putExtra("Nick", nick);
        myPosts.setContent(postsIntent);
        tabHost.addTab(myPosts); // Adding Posts tab
		// Get the user nick passed through intent.

		int tab = myIntent.getIntExtra("tab",0);
		tabHost.setCurrentTab(tab);

	}

	public void imageClick(View view) {
		// Implement image click function
		Intent a = new Intent(getApplication(), Main.class);
		// Make "home" the top activity
		a.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		startActivity(a);
		finish();
		return;
	}
}
